/**
 * 公共请求模块
 */
import request from "@/utils/request";

// 管理员登录
export const Login = (data: any) => {
  return request({
    method: "post",
    url: "/login",
    data: data,
  });
};

// 图形验证码
export const GraVerCode = (data: any) => {
  return request({
    method: "GET",
    url: `/kaptcha`,
    responseType: "arraybuffer",
  });
};

// 上传文件 myfiles
export const UploadFile = (data: any) => {
  return request({
    method: "post",
    url: "/aliyunoss/duowenjianshangchuan",
    data: data,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
};

// 获取上传凭证
export const GetCredential = (data: any) => {
  return request({
    method: "get",
    url: "/aliyunoss/policy",
    data,
  });
};

export const GetUploadUrl = (data: any) => {
  return request({
    method: "get",
    url: "/aliyunoss/uploadSign",
    data,
  });
};

export const UploadUserFile = (data: any) => {
  return request({
    method: "post",
    url: "/user/import",
    data: data,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
};

export const UploadExpertFile = (data: any) => {
  return request({
    method: "post",
    url: "/expert/import",
    data: data,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
};

// 获取菜单
export const getMenu = (data: any) => {
  return request({
    method: "GET",
    url: "/menu/tree",
  });
};

// 退出
export const ManageExit = (data: any) => {
  return request({
    method: "DELETE",
    url: "/login",
  });
};
